/**
* 左边菜单
*/
<template>
  <el-menu
    default-active="2"
    :collapse="collapsed"
    collapse-transition
    router
    unique-opened
    class="el-menu-vertical-demo"
    background-color="black"
    text-color="#fff"
    active-text-color="#ffd04b"
  >
    <div class="logobox">
      <div>青云管理</div>
      <!-- <img class="logoimg" src="../assets/img/logo.png" alt="" /> -->
    </div>
    <el-submenu
      v-for="menu in allmenu"
      :key="menu.menuid"
      :index="menu.menuname"
    >
      <template slot="title">
        <i class="iconfont" :class="menu.icon"></i>
        <span>{{ menu.menuname }}</span>
      </template>
      <el-menu-item-group>
        <el-menu-item
          v-for="chmenu in menu.menus"
          :index="'/' + chmenu.url"
          :key="chmenu.menuid"
        >
          <i class="iconfont" :class="chmenu.icon"></i>
          <span>{{ chmenu.menuname }}</span>
        </el-menu-item>
      </el-menu-item-group>

    </el-submenu>
  </el-menu>
</template>
<script>
export default {
  name: "leftnav",
  data() {
    return {
      collapsed: false,
      allmenu: [],
    };
  },
  // 创建完毕状态(里面是操作)
  created() {
    // 获取图形验证码
    let res = {
      success: true,
      data: [
        {
          menuid: 1,
          icon: "li-icon-xiangmuguanli",
          menuname: "工作桌面",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 11,
              icon: "icon-cat-skuQuery",
              menuname: "工作桌面",
              hasThird: "N",
              url: "goods/Goods",
              menus: null,
            },
          ],
        },
        {
          menuid: 2,
          icon: "li-icon-xiangmuguanli",
          menuname: "销售门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 12,
              icon: "li-icon-xiangmuguanli",
              menuname: "销售门户",
              hasThird: "N",
              url: "product/ProductClass",
              menus: null,
            },
          ],
        },
        {
          menuid: 3,
          icon: "li-icon-xiangmuguanli",
          menuname: "合同门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 13,
              icon: "icon-contract-manage",
              menuname: "合同",
              hasThird: "N",
              url: "maheimei/Portal",
              menus: null
            }
          ]
        },
        {
          menuid: 4,
          icon: "li-icon-xiangmuguanli",
          menuname: "财务门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 14,
              icon: "icon-contract-manage",
              menuname: "财务门户",
              hasThird: "N",
              url: "finance/finance",
              menus: null
            }
          ]
        },
        {
          menuid: 5,
          icon: "li-icon-xiangmuguanli",
          menuname: "项目门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 15,
              icon: "icon-contract-manage",
              menuname: "项目门户",
              hasThird: "N",
              url: "xiangmu/xianmu",
              menus: null
            }
          ]
        },
        {
          menuid: 6,
          icon: "li-icon-shangchengxitongtubiaozitihuayuanwenjian91",
          menuname: "采购门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 16,
              icon: "icon-provider-manage",
              menuname: "采购门户",
              hasThird: "N",
              url: "BasicInformation/SzProject",
              menus: null,
            },
          ],
        },
        {
          menuid: 7,
          icon: "li-icon-dingdanguanli",
          menuname: "研发门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 17,
              icon: "icon-order-manage",
              menuname: "研发门户",
              hasThird: "N",
              url: "charts/statistics",
              menus: null,
            },

          ],
        },
        {
          menuid: 8,
          icon: "li-icon-dingdanguanli",
          menuname: "人才中心",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 18,
              icon: "icon-order-manage",
              menuname: "人才中心",
              hasThird: "N",
              url: "pay/Order",
              menus: null,
            },
          ],
        },
        {
          menuid: 9,
          icon: "li-icon-xiangmuguanli",
          menuname: "人事门户",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 19,
              icon: "icon-contract-manage",
              menuname: "人事门户",
              hasThird: "N",
              url: "personnel/personnel",
              menus: null
            }
          ]
        },
        {
          menuid: 14,
          icon: "li-icon-xiangmuguanli",
          menuname: "智能销售分析",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 25,
              icon: "icon-contract-manage",
              menuname: "智能销售分析",
              hasThird: "N",
              url: "Visualization/VchartAll",
              menus: null
            }
          ]
        },
        {
          menuid: 10,
          icon: "li-icon-xiangmuguanli",
          menuname: "薪资管理",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 18,
              icon: "icon-contract-manage",
              menuname: "薪资管理",
              hasThird: "N",
              url: "salary/salarymanagement",
              menus: null
            }
          ]
        },
         {
          menuid: 14,
          icon: "li-icon-xiangmuguanli",
          menuname: "邮箱",
          hasThird: null,
          url: null,
          menus: [
            {
              menuid: 25,
              icon: "el-icon-message",
              menuname: "邮箱",
              hasThird: "N",
              url: "maheimei/email",
              menus: null
            }
          ]
        },


      ],
      msg: "success",
    };
    this.allmenu = res.data;
    // 监听
    this.$root.Bus.$on("toggle", (value) => {
      this.collapsed = !value;
    });
  },
};
</script>
<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}
.el-menu-item-group__title {
  padding: 0px;
}
.el-menu-bg {
  background-color: #9c0909 !important;
}
.el-menu {
  border: none;
}
.logobox {
  height: 40px;
  /* line-height: 40px; */
  color: white;
  font-size: 25px;
  /* text-align: center; */
  padding: 20px 30px;
}
.logoimg {
  height: 40px;
}
</style>
